<!doctype html><html><head><meta charset="utf-8">
<title><%= siteName %>-后台管理登陆</title>
<link href="./style/css/login.css?<%=timer%>" rel="stylesheet" />
<script src="./style/js/jquery-2.1.4.min.js"></script>
<meta name="renderer" content="webkit" />
</head>
<body>
<div class="login dn">
	<div class="box">
		<div class="close">
		    <a title="关闭" onclick="window.close();" href="javascript:;"></a>
		</div>
		<form id="cjAspLogin" action="./login.asp?q=login" method="post">
			<ul class="content">
				<li class="name item">
					<input name="adminName" placeholder="登录名" maxlength="30" class="text must" type="text">
				</li>
				<li class="password item">
					<input name="password" placeholder="密码" maxlength="20" class="text must" type="password">
				</li>
				<li class="code item">
					<input name="checkCode" size="<%=checkAmount*2%>" placeholder="验证码" maxlength="<%=checkAmount%>" class="check must fl" type="text">
					<img class="checkCode fl" id="codeImage" title="看不清楚，换张图片" src="<%=siteUrl%>code.asp" />
				</li>
			<% if adminKey <> "" then %>
				<li class="key_code item">
					<input name="adminKey" placeholder="后台认证码" class="check must" type="password">
				</li>
			<% end if %>
			</ul>
			<div title="登陆系统" class="submit_box">
                <input class="submit" type="submit" value="">
            </div>
		</form>
	</div>
</div>
<script>
axis = 900000;
$.clew = function(opts) {
	var opt = $.extend({
			c: '',
			w: 500,
			s: 3,
			callback: null
		}, opts || {}), box = $("#clew_box"), content, win = $(window), w = opt.w,
		callback = opt.callback;
	if(!box[0]) {
		box = $(['<div id="clew_box" class="panel" style="z-index:' + (++axis) + '">',
		 '<div class="panel-heading">信息提示</div>',
         '<div class="panel-body" id="clew_content"></div>',
         '</div>'].join('')).appendTo(document.body);
	}
    content = $('#clew_content');
    content.html(opt.c);
	if(box.is(":hidden")) {
		box.css({width: w, left: (win.width() - w ) / 2, top: 50, opacity: 0}).show(0)
			.animate({top: "+=30", opacity: 1}, 400)
			.animate({top: 80}, opt.s * 1000)
			.animate({top: "-=30", opacity: 0}, 500, function () {
				box.hide(0);
				if ($.isFunction(callback)) {
					callback.call(this, callback);
				}
			});
	} else {
		box.stop(true, true).hide(0);
		content.empty();
		$.clew(opts);
	}
};
$(document).ready(function(){
	var isGet = false, code = '<%=siteUrl%>code.asp';
	$('.login').fadeIn(600);
$(this)
	.on('click', '#codeImage', function () {
		this.src = code + "?rand=" + new Date().valueOf();
	})
	.on('focusin', '.must', function () {
		$(this)[this.value == '' ? 'addClass' : 'removeClass']('waring').select();
	})
	.on('input', '.must', function () {
		$(this)[this.value == '' ? 'addClass' : 'removeClass']('waring');
	})
	.on('submit', 'form', function(){
		if(isGet) {
			return false;
		}
		var self = $(this), check = true, text = {
			i0: ['登陆成功，3秒后进入后台'],
			i1: ['后台管理认证码不对，请重新输入', 'adminKey'],
			i2: ['请输入验证码', 'checkCode'],
			i3: ['验证码错误，请重新输入验证码', 'checkCode'],
			i4: ['请输入名称', 'adminName'],
			i5: ['请输入密码', 'password'],
			i6: ['名称或密码错误', 'checkCode']
		}, msg = [];
		self.find('input.must').each(function () {
			var self = $(this), vs = this.value == '';
			self[vs ? 'addClass' : 'removeClass']('waring');
			if(vs) {
				msg.push(self.attr('placeholder'));
				check = false;
			}
		});
		if(!check) {
		    $('.waring').eq(0).select().trigger('focus');
		    $.clew({c: msg.join('、') + ' 不能为空！'});
		    return false;
		}
		if(check) {
			isGet = true;
			$.post(self.attr('action'), self.serializeArray(), function (a) {
				isGet = false;
				if(!$.isEmptyObject(a)) {
					if(a.error == 0) {
						setTimeout(function () {
							location.href = './index.asp';
						}, 3000);
					}
					var c = a.message, d = text['i' + c] || {};
					if(c == 1 || c == 2 || c == 3 || c == 6) {
						$('#codeImage').trigger('click');
					}
					if(d[1]) {
						self.find('input[name="' + d[1] + '"]').select().trigger('focus');
					}
					$.clew({c: d[0]});
				} else {
					$.clew({c: '响应错误'});
				}
			}, 'json');
		}
		return false;
	});
});
</script>
</body></html>